package com.hn.vue.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

/**
 * hanni
 * 2019/3/8 0008
 * 10:05
 */
@Configuration
public class BaseConfiguration {


    //引入认证成功之后的处理器
    @Bean
    public AuthenticationSuccessHandler authenticationSuccessHandler(){
        return new HnAuthenticationSuccessHandler();
    }


    //引入认证失败的处理器
    @Bean
    public AuthenticationFailureHandler authenticationFailureHandler(){
        return new HnAuthenticationFailureHandler();
    }

    @Bean
    public UserDetailsService userDetailsService(){

        return new HnUserDetailsService();
    }

    @Bean
    public LogoutSuccessHandler logoutSuccessHandler(){
        return new MyLogoutSuccessHandler();
    }


}
